package com.fa4j.common.feign.config;

import com.fa4j.common.feign.decoder.ResponseWrapperFeignDecoder;
import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Feign;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;


@AutoConfiguration
@PropertySource(value = "classpath:common-feign-default.properties")
public class CommonFeignAutoConfiguration {

    @Bean
    public ResponseWrapperFeignDecoder responseWrapperFeignDecoder(ObjectMapper objectMapper) {
        return new ResponseWrapperFeignDecoder(objectMapper);
    }

    @Bean
    public Feign.Builder decodeVoidFeignBuilder() {
        return Feign.builder().decodeVoid();
    }

}
